﻿using System;

namespace Thinker.SignChannel.Results;

public static class SignResultCreateStyleExtensions
{
    public static SignResultCreateStyle FromSetting(this string value)
    {
        if (int.TryParse(value, out var result))
        {
            return (SignResultCreateStyle)result;
        }

        throw new ArgumentException($"无法从 {value} 转换 SignResultCreateStyle", nameof(value));
    }

    public static string ToSetting(this SignResultCreateStyle value)
    {
        var intValue = (int)value;
        return intValue.ToString();
    }
}